package ui.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;
import ui.model.bo.DemoInfoBo;
import ui.model.po.DemoInfoPo;
import ui.service.DemoInfoService;

import java.util.Map;

/**
 * Created by qiang.yu on 2017/5/2.
 */
@Controller
@RequestMapping("/demo/info")
public class DemoInfoController {

    @Autowired
    private DemoInfoService demoInfoService;

    @RequestMapping("/index")
    public ModelAndView index(){
        ModelAndView model = new ModelAndView();
        model.setViewName("index/inputShow");
        return model;
    }

    @RequestMapping("/getAllDemoInfo")
    @ResponseBody
    public Map<String,Object> getAllDemoInfo(DemoInfoBo bo){
        return demoInfoService.getAllDemoInfo(bo);
    }

    @RequestMapping("/updateDemoInfo")
    @ResponseBody
    public Map<String,Object> updateDemoInfo(DemoInfoPo po){
        return demoInfoService.updateDemoInfoByPkid(po);
    }

    @RequestMapping("/insertDemoInfo")
    @ResponseBody
    public Map<String,Object> insertDemoInfo(DemoInfoPo po){
        return demoInfoService.insertDemoInfo(po);
    }

    @RequestMapping("/deleteDemoInfo")
    @ResponseBody
    public Map<String,Object> deleteDemoInfo(DemoInfoPo po){
        return demoInfoService.deleteDemoInfo(po);
    }
}
